﻿
cmake_minimum_required (VERSION 3.7)

project (cc9d)

include_directories(
	./
	../support
	../serial-port
	)
	
aux_source_directory(../support DIR_SUPPORT)
 

add_library(cc9d SHARED cc9d.cpp)
set_target_properties(cc9d PROPERTIES LINKER_LANGUAGE CXX)

find_library(SERIAL_PORT_LIB serialport PATHS ../build/serial-port/Debug)
MESSAGE("SERIAL_PORT_LIB is ${SERIAL_PORT_LIB}")

add_executable (cc9d_tester ${DIR_SUPPORT} cc9d_tester.cpp)
target_link_libraries (cc9d_tester cc9d ${SERIAL_PORT_LIB})

add_custom_command(TARGET cc9d_tester POST_BUILD
    COMMAND ${CMAKE_COMMAND} -E copy_if_different
    "${CMAKE_SOURCE_DIR}/build/serial-port/Debug/serialport.dll"
    $<TARGET_FILE_DIR:cc9d_tester>)